import mongoose from "mongoose"

export const connectDB =  async () =>{
    try {
        await mongoose.connect('mongodb://127.0.0.1:27017/demo')
        console.log('mongoose ok',mongoose.connection.host)
    } catch (error) {
        console.log('mongoose error',error)
    }
}

const TopicsSchema = new mongoose.Schema({
    title:String,
    describe:String
  })

  
export const TopicsModel = mongoose.models.topics || mongoose.model('topics',TopicsSchema)

